<include file="Public:header" />
<!--主体内容-->
<!--左边-->
<div class="centent_box">
    <include file="Public:left" />
    <!--右边-->
    <div class="centent_right_box">
        <div class="centent_right rightCon">
            <div class="Mtitle">
                <ul>
                    <li class="on"><span>客源列表</span></li>
                </ul>
            </div>
            <div class="table all">
                <table class="tab_list">
                    <tr>
                        <th style="width: 15%">联系人</th>
                        <th style="width: 20%">小区名称</th>
                        <th style="width: 10%">等级</th>
                        <th style="width: 15%">状态</th>
                        <th style="width: 10%">录入人</th>
                        <th style="width: 10%">录入时间</th>
                        <th style="width: 20%">操作</th>
                    </tr>
                    <volist name="list['list']" id='vo'>
                        <tr>
                            <td>{$vo.title}</td>
                            <td>{$vo.etitle}</td>
                            <td>{$vo.leve}级</td>
                            <td class="green">
                                <if condition="$vo.state eq 0">未审核</if>
                                <if condition="$vo.state eq 1">有效</if>
                                <if condition="$vo.state eq 2">资料</if>
                                <if condition="$vo.state eq 3">成交</if>
                                <if condition="$vo.state eq 4">暂停</if>
                                <if condition="$vo.state eq 5">回收</if>
                            </td>
                            <td>{$vo.username}</td>
                            <td>{$vo.add_time}</td>
                            <td class="dn">
                                <a href="{:U('Cust/edit',array('id'=>$vo['id']))}">编辑</a>
                                <if condition="$vo.username eq $user[username] && $userCate.id neq 1"><span>|</span>
                                    <a href="{:U('Cust/follow',array('id'=>$vo['id']))}">跟进</a></if><span>|</span>
                                <a href="{:U('Cust/del',array('id'=>$vo['id']))}">删除</a><td>
                        </tr>
                    </volist>
                </table>
                <div class="page">
                    {$list.page}
                </div>
            </div>
        </div>
    </div>
</div>
<div id="follow">

</div>
<script>
function swit (tar, id){
    $(tar).addClass('on');
    $(tar).nextAll('li').removeClass('on');
    $(tar).prevAll('li').removeClass('on');
    $('.table').addClass('table-hide');
    $('.'+id).removeClass('table-hide');
}
function addfollow(user_id,number,source_id){
    var id = '';
    //先添加点击查看联系电话的事件记录
    $.ajax({
        type: "post",
        url : "{:U('Ajax/addFollow')}",
        dataType:'json',
        data:{user_id:user_id,source_id:source_id,type:2,discuss:'查看电话，未添加跟进信息'},
        success: function(data){
            if(data.status == 1){
                id = data.id;
            }else {
                layer.alert("查看联系电话失败1");
                return false;
            }
        }});
    layer.confirm('联系电话：'+ number, {
        closeBtn: 0,
        btn: ['添加跟进信息'] //按钮
    }, function(){
        layer.prompt({
            title: '跟进信息',
            closeBtn: 0,
            formType: 2 //prompt风格，支持0-2
        }, function(text){
            //补充跟进信息
            $.ajax({
                type: "post",
                url : "{:U('Ajax/editFollow')}",
                dataType:'json',
                data:{user_id:user_id,source_id:source_id,type:2,discuss:text,id:id},
                success: function(json){
                    layer.close(2);
                    layer.alert(json.msg,0,'',close);

                }
            });

        });
    });



}
</script>
<include file="Public:footer" />